package com.company;

import java.util.Scanner;

/**
 * 编写程序，编写数组，保存一个人的名字，并统计姓名所以姓张的人的数目。
 */
public class demo09 {
    public static void main(String[] args) {
        Scanner sr = new Scanner(System.in);
        String [] names = {"张广明","熊湘玉","刘馨蔚","陈美","张杰","张飞","陈奕迅"};
        int sum = 0;
        String n = "张";
        System.out.println("所有人的姓名为：");
        for (String name:names){
            System.out.println(name+" ");
            if (name.startsWith("张")){
                sum++;
            }
        }
        System.out.println(" ");
        System.out.println("姓张的人数为："+sum);
    }
}
